<template>
  <div>
    <div ref="title">{{info.name}}</div>
    <div ref="title">{{name}}</div>
    <button @click="change">修改</button>
  </div>
</template>

<script>
import { ref, watch, reactive } from 'vue'
export default {
  setup() {
    const change = () => {
      info.name = '王五'
      name.value = '王五'
    }
    const name = ref('李四')
    const info = reactive({name:'张三', age: '12'})
    // 多个数据
    watch([name, () => ({...info})], (newValue, oldValue) => {
       console.log('newValue:', newValue, 'oldValue:', oldValue)
    }, {
      deep: true // 深度监听
    })
    
    return {
      info,
      change,
      name
    }
  }
}
</script>

<style>

</style>